#include"string.h"


namespace zy
{
	void zy::test_string1()
	{
		string s1;
		string s2("hello world");
		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;

		for (size_t i = 0; i < s2.size(); i++)
		{
			s2[i] += 2;
		}

		cout << s2.c_str() << endl;

		for (auto e : s2)
		{
			cout << e << " ";
		}
		cout << endl;

		string::iterator it = s2.begin();
		while (it != s2.end())
		{
			//*it += 2;
			cout << *it << " ";
			++it;
		}
		cout << endl;
	}

	void test_string2()
	{
		string s1("hello world");
		//s1 += 'x';
		//s1 += '#';
		//cout << s1.c_str() << endl;

		//s1 += "hello bit";
		//cout << s1.c_str() << endl;

		//s1.insert(5, '$');
		//cout << s1.c_str() << endl;

		//s1.insert(0, '$');
		//cout << s1.c_str() << endl;

		//string s2("hello world");
		//cout << s2.c_str() << endl;

		//s2.insert(5, "$$$");
		//cout << s2.c_str() << endl;

		//s2.insert(0, "$$$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
		//cout << s2.c_str() << endl;

		string s2 = s1;
		cout << s2.c_str()<<endl;

		string s3("hello wored");
		cout << s3.c_str() << endl;
		s3 = s2;
		cout << s3.c_str() << endl;
	}

	void test_string3()
	{
		string s1;
		cout << s1 << endl;
		cin >> s1;
		cout << s1 << endl;
	}

}


int main()
{
	zy::test_string1();
	//zy::test_string2();
	//zy::test_string3();

	return 0;
}